﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Email.aspx.cs" Inherits="famails.BackEnd.page.Email" MasterPageFile="~/Master.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script>
        $('#ctl00_ctl00_ContentPlaceHolder1_dtlCustomer_ctl00_chkAll:checkbox').change(function () {
            if ($(this).attr("checked")) $('input:checkbox').attr('checked', 'checked');
            else $('input:checkbox').removeAttr('checked');
        }); 
    </script>
<div style="width:100%;padding:10px;">
<!--start content 01-->
    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="border:1px solid #333;margin-bottom:10px;padding:0px;">
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:10px 20px;background:#000;color:#fff;font-size:18px;font-weight:bold;position:relative;">   
            Thêm email
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:10px;">
        <asp:HiddenField ID="hdfCustomerId" runat="server" />
        <asp:Panel Visible="false" ID="pnError" runat="server">
            <div class="error-box round">
                <asp:Label ID="lblError" runat="server" Text=""></asp:Label>
            </div>
        </asp:Panel>
        <asp:Panel Visible="false" ID="pnSuccess" runat="server">
            <div class="confirmation-box round">
                <asp:Label ID="lblSuccess" runat="server" Text=""></asp:Label>
            </div> 
        </asp:Panel>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Họ và tên</label>
                    <asp:TextBox ID="txtName" CssClass="form-control" style="border:1px solid #333;border-radius:0px;" runat="server"></asp:TextBox>
                    <em style="color:#333;">Tên đầy đủ của khách hàng</em>
                </p>
            </fieldset>
        </div>


        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Di động</label>
                    <asp:TextBox ID="txtPhone" CssClass="form-control" style="border:1px solid #333;border-radius:0px;" runat="server"></asp:TextBox>
                    <em style="color:#333;">Số di động khách hàng.</em>
                </p>
            </fieldset>
        </div>

        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Giới tính</label>
                    <asp:DropDownList ID="drlGender" runat="server" CssClass="form-control" style="border:1px solid #333;border-radius:0px;"  AutoPostBack="true">
                        <asp:ListItem Value="Nam">Nam</asp:ListItem>
                        <asp:ListItem Value="Nu">Nữ</asp:ListItem>
                    </asp:DropDownList>
                    <em style="color:#333;">Giới tính khách hàng</em>
                </p>
            </fieldset>
        </div>


        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Nghề nghiệp</label>
                    <asp:TextBox ID="txtHomePhone" CssClass="form-control" style="border:1px solid #333;border-radius:0px;" runat="server"></asp:TextBox>
                    <em style="color:#333;">Nghề nghiệp.</em>
                </p>
            </fieldset>
        </div>


        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Ngày sinh</label>
                    <%--<asp:TextBox ID="txtBirthday" CssClass="form-control" style="border:1px solid #333;border-radius:0px;"  runat="server"></asp:TextBox>--%>
                    <div id="txtBirthday" style="border-radius:0px;"></div>
                    <asp:HiddenField runat="server" id="txtBirthday_v" ></asp:HiddenField>
                    <em style="color:#333;">Ngày sinh của khách hàng.</em>
            </fieldset>
        </div>

        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Địa chỉ</label>
                    <asp:TextBox ID="txtAddress" CssClass="form-control" style="border:1px solid #333;border-radius:0px;" runat="server"></asp:TextBox>
                    <em style="color:#333;">Địa chỉ khách hàng.</em>
                </p>
            </fieldset>
        </div>

        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Email</label>
                    <asp:TextBox ID="txtEmail" CssClass="form-control" style="border:1px solid #333;border-radius:0px;" runat="server"> </asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail"
                                Display="Dynamic" ErrorMessage="Email không hợp lệ" ValidationExpression="^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"
                                ValidationGroup="CheckInput_Email"></asp:RegularExpressionValidator>
                    <em style="color:#333;">Email của khách hàng.</em>
                </p>
            </fieldset>
        </div>

        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Nhóm email</label>
                    <asp:DropDownList ID="drlGroup"  runat="server" CssClass="form-control" style="border:1px solid #333;border-radius:0px;">
                    </asp:DropDownList>
                    <em style="color:#333;">Địa chỉ nhóm email.</em>
                    <asp:HiddenField ID="CustomerID" runat="server" />
                </p>
            </fieldset>
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:5px;">
                            <button runat="server" class="btn" style="background:#333;color:#fff;text-align:center;padding:6px 15px;border-radius:0px;" onserverclick="btnAdd_Click">
                                <i class="fa fa-save"></i> Lưu
                            </button>
                            <button runat="server" class="btn" style="background:#333;color:#fff;text-align:center;padding:6px 15px;border-radius:0px;" onserverclick="btnRefesh_Click">
                                <i class="fa fa-refresh"></i> Làm mới
                            </button>
                            <button runat="server" class="btn" style="background:#333;color:#fff;text-align:center;padding:6px 15px;border-radius:0px;" onserverclick="btnBack_Click">
                                <i class="fa fa-sign-out"></i> Đóng
                            </button>
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:10px 20px;background:#000;color:#fff;font-size:18px;font-weight:bold;position:relative;">   
            Thêm email từ file Excel
        </div>
        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <asp:FileUpload ID="fileExcel" runat="server" CssClass="form-control" style="border:1px solid #333;border-radius:0px;" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" />
                </p>
            </fieldset>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <asp:Button ID="btnReadExcel" runat="server" Text="Đọc file" CssClass="form-control" style="text-align:center;float:left;border:1px solid #333;border-radius:0px;width:120px;padding:5px 10px;background:#333;color:#fff;"
                        OnClick="btnReadExcel_Click" />
                    <span style="float:left;margin-left:10px;line-height:30px;color:#333;"> >> Tải danh sách khách hàng mẫu <a href="../../../file/Customer.xls">tại đây</a></span>
                </p>
            </fieldset>
        </div>
         
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:10px;">
                <fieldset>
                    <div class=" table-responsive">
                    <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                        <thead>
                            <tr>
                                <th><input type="checkbox" onclick="checkAll()" value="All" /></th>
                                <th>Tên</th>
                                <th>Email</th>
                                <th>Giới tính</th>
                                <th>Nghề nghiệp</th>
                                <th>Năm sinh</th>
                                <th>Phone</th>
                                <th>Địa chỉ</th>
                            </tr>
                        </thead>
                        <tbody>
                            <asp:Label hidden ID="lblAddr" runat="server" Text='<%# Eval("Address") %>'></asp:Label>
                    <asp:Repeater ID="dtlCustomer" runat="server">
                         <ItemTemplate>

                            
                            <tr>
                                <td>
                                    <asp:CheckBox ID="chkCheck" runat="server" />
                                </td>
                                <td>
                                     <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>     
                                </td>
                                <td>
                                    <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblGender" runat="server" style="text-align:center" Text='<%# Eval("Gender") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblJob" runat="server" style="text-align:center" Text='<%# Eval("Job") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblBirthDay" runat="server" style="text-align:center" Text='<%# (Eval("Birthday")+""==""?"":Convert.ToDateTime(Eval("Birthday")).ToString("dd/MM/yyyy")) %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblPhone" runat="server" Text='<%# Eval("Phone") %>'></asp:Label>
                                </td>
                                <td>
                            <asp:Label hidden ID="lblAddr" runat="server" Text='<%# Eval("Address") %>'></asp:Label>
                                </td>
                            </tr>     
                         </ItemTemplate>
                     </asp:Repeater>
                        </tbody>
                    </table>
                    </div>
                </fieldset>
        </div>

        <%--<div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;">
                    <asp:DataList ID="dtlCustomer" runat="server">
                        <HeaderTemplate>
                            <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="background:#333;padding:10px">
                                <div class="col-md-1 col-lg-1 col-sm-1 col-xs-2" style="color:#fff;">
                                    <input type="checkbox" onclick="checkAll()" value="All" />
                                </div>
                                <div class="col-md-11 col-lg-11 col-sm-11 col-xs-11" style="color:#fff;font-weight:bold;">
                                    <div class="col-md-3 col-lg-3 col-sm-3 col-xs-12" style="padding:5px;font-weight:bold;">
                                        Tên
                                    </div>
                                    <div class="col-md-3 col-lg-3 col-sm-3 col-xs-12" style="padding:5px;">
                                        Email
                                    </div>
                                    <div class="col-md-2 col-lg-2 col-sm-2 col-xs-12" style="padding:5px;">
                                        Giới tính
                                    </div>
                                    <div class="col-md-2 col-lg-2 col-sm-2 col-xs-12" style="padding:5px;">
                                        Năm sinh
                                    </div>
                                    <div class="col-md-2 col-lg-2 col-sm-4 col-xs-12" style="padding:5px;">
                                        Phone
                                    </div>
                                </div>
                            </div>
                        </HeaderTemplate>
                        <ItemTemplate>
                            
                                <asp:Label hidden ID="lblAddr" runat="server" Text='<%# Eval("Address") %>'></asp:Label>
                            <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12" style="background:#fff;padding:10px">
                                <div class="col-md-1 col-lg-1 col-sm-1 col-xs-1" style="color:#333;">
                                    <asp:CheckBox ID="chkCheck" runat="server" />
                                </div>
                                <div class="col-md-11 col-lg-11 col-sm-11 col-xs-11" style="color:#333;">
                                    <div class="col-md-3 col-lg-3 col-sm-3 col-xs-12" style="padding:5px;font-weight:bold;">
                                        <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>     
                                    </div>
                                    <div class="col-md-3 col-lg-3 col-sm-3 col-xs-12" style="padding:5px;">
                                        <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>'></asp:Label>
                                    </div>
                                    <div class="col-md-2 col-lg-2 col-sm-2 col-xs-12" style="padding:5px;">
                                        <asp:Label ID="lblGender" runat="server" style="text-align:center" Text='<%# Eval("Gender") %>'></asp:Label>
                                     </div>
                                    <div class="col-md-2 col-lg-2 col-sm-2 col-xs-12" style="padding:5px;">
                                        <asp:Label ID="lblBirthDay" runat="server" style="text-align:center" Text='<%# Eval("Birthday") %>'></asp:Label>
                                    </div>
                                    
                                    <div class="col-md-2 col-lg-2 col-sm-4 col-xs-12" style="padding:5px;">
                                        <asp:Label ID="lblPhone" runat="server" Text='<%# Eval("Phone") %>'></asp:Label>
                                    </div>
                                </div>
                            </div>
                            
                        </ItemTemplate>
                    </asp:DataList>
        </div>--%>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:10px;">
            <asp:Panel ID="pnSelectGroup" runat="server">
            <fieldset>
                <p>
                    <div class="col-md-2 col-xs-12 col-sm-6 col-lg-2">
                        <a href="group-mail.aspx" style="color:#fff;font-weight:bold;text-decoration:none;"><div id="pnBackAddGroup" class="form-control" style="background:#333;text-align:center;border:1px solid #333;border-radius:0px;width:120px;padding:7px 14px;color:#fff;">
                           <span class="fa fa-users"></span> Tạo nhóm</div></a>
                    </div>
                    <div class="col-md-2 col-xs-12 col-sm-6 col-lg-2">
                    <label for="table-select-actions" style="font-weight: bolder;line-height:30px;">
                        Lựa chọn:</label>
                    </div>
                    <div class="col-md-6 col-xs-12 col-sm-6 col-lg-6">
                    <asp:DropDownList ID="drlMailGroup" runat="server"  class="form-control" style="text-align:center;border:1px solid #333;border-radius:0px;padding:5px 10px;">
                        <asp:ListItem Value="0">All</asp:ListItem>
                    </asp:DropDownList>
                    </div>
                    <div class="col-md-2 col-xs-12 col-sm-6 col-lg-2" style="padding:0px;">
                        <button  runat="server" class="btn" style="background:#333;color:#fff;text-align:center;padding:6px 15px;border-radius:0px;" onserverclick="btnSave_Click">
                            <span  class="fa fa-plus"></span> Thêm vào
                        </button>
                    </div>

                </p>
            </fieldset>
                </asp:Panel>
        </div>
    </div>
</div>
<script>
    function checkAll() {
        var checked = !$(this).data('checked');
        $('input:checkbox').prop('checked', checked);
        $(this).data('checked', checked);
    }
</script>
    <script type="text/javascript">
        
            $(function () {
                $("#txtBirthday").jqxDateTimeInput({ width: '120px', height: '34px' });
                if ($('#ContentPlaceHolder1_txtBirthday_v').val() != undefined) {
                    $('#txtBirthday').jqxDateTimeInput('val', $('#ContentPlaceHolder1_txtBirthday_v').val());
                    $('#ContentPlaceHolder1_txtBirthday_v').val($("#txtBirthday").jqxDateTimeInput("getText"));
                }

                $('#txtBirthday').on('valuechanged', function (event) {
                    $('#ContentPlaceHolder1_txtBirthday_v').val($("#txtBirthday").jqxDateTimeInput("getText"));
                    //alert($('#ContentPlaceHolder1_txtBirthday_v').val());
                });
            });
       
    </script>
</asp:Content>

